<script>
  let value = 0

  let color = 'red'
</script>

今天收入：<input bind:value class:error={isNaN(Number(value))} />
<button class="btn"  style="--color: {color}">按钮</button>
<style>
  .error { border: 1px solid red; }
  input { outline: 0 none; }
  .btn{
    color:var(--color);
  }
</style>
